package com.ujs.edu.demo.controller;

import com.ujs.edu.demo.config.NeedLogin;
import com.ujs.edu.demo.dao.BcAdminMapper;
import com.ujs.edu.demo.dao.BcNewsMapper;
import com.ujs.edu.demo.dataobject.BcNews;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class IndexController {

    @Autowired
    private BcNewsMapper bcNewsMapper;

    @RequestMapping(path = "index")
    public ModelAndView toindex(){
        ModelAndView view=new ModelAndView();

        List<BcNews>bcNews=bcNewsMapper.selectAll();
        view.addObject("news",bcNews);

        view.setViewName("index");
        return view;
    }
}
